#ifndef _DATA_STRUCTURE_H_
#define _DATA_STRUCTURE_H_

#include "Attribute.h"
#include "AttributeSet.h"
#include "Object.h"
#include "ObjectSet.h"
#include <vector>
#include <map>
#include <ostream>

// main storage structure
class DataStructure {
public:
    DataStructure();
    ~DataStructure();
    // adds an object to set of objects that are the support of attribute attr
    void updateAttribute(const Attribute &attr, const Object &obj);
    // adds a new object with a complete set of attributes it contains
    void addObject(const Object &obj, AttributeSet *aSet);
    // returns a set of attributes that are supported by the given object
    AttributeSet* getAttributes(const Object &obj) { return _objs[obj-1]; }
    // returns a set of objects that support the given attribute
    ObjectSet* getObjects(const Attribute &attr) { return _attrs[attr]; }
    // returns the set of all attributes
    AttributeSet* getAllAtributes() { return this->_allAttrs; }
    // returns the set of all objects
    ObjectSet* getAllObjects() { return this->_allObjs; }
    // prints a brief summary to the out stream
    void printSummary(std::ostream &out);
private:
    std::map<Attribute, ObjectSet*> _attrs;
    std::vector<AttributeSet*> _objs;
    AttributeSet* _allAttrs;
    ObjectSet* _allObjs;
};

#endif